﻿#define DEMO

using BankSystemWithCSharp.DataBase;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace BankSystemWithCSharp
{
    public partial class ATMForm : Form
    {
        private LoginPanel loginPanel;
        private FuncPanel funcPanel;
        public ATMForm()
        {
            InitializeComponent();
            loginPanel = new LoginPanel(LoginSuccess);
            loginPanel.Dock = DockStyle.Fill;
            panel1.Controls.Add(loginPanel);
            funcPanel = new FuncPanel(Logout);
            funcPanel.Dock = DockStyle.Fill;
        }
        private void Logout()
        {
            panel1.Controls.Remove(funcPanel);
            panel1.Controls.Add(loginPanel);
            loginPanel.Clear();
        }
        private void LoginSuccess()
        {
            panel1.Controls.Remove(loginPanel);
            panel1.Controls.Add(funcPanel);
        }

        private void ATMForm_Load(object sender, EventArgs e)
        {
#if DEMO
            // test code
            IDemo demo = new ATMDemoController();
            Point startPos = Location + new Size(Size.Width, 0);
            Debug.WriteLine(string.Format("Demo Start Position: {0}", startPos));
            demo.AddDemo(startPos);
#endif
        }
    }
}
